home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Balloons.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  11.8 KB  |  345 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Balloons.h
  3.  
  4.      Contains:    Balloon Help Package Interfaces.
  5.  
  6.      Version:    Technology:    System 7.0
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1990-1993, 1995-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __BALLOONS__
  18. #define __BALLOONS__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __QUICKDRAW__
  25.     #include <Quickdraw.h>
  26. #endif
  27.  
  28. #ifndef __MENUS__
  29.     #include <Menus.h>
  30. #endif
  31.  
  32. #ifndef __TEXTEDIT__
  33.     #include <TextEdit.h>
  34. #endif
  35.  
  36. #ifndef __MACERRORS__
  37.     #include <MacErrors.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. /*
  64.    Carbon clients should use MacHelp. The definitions below will NOT work for Carbon and
  65.    are only defined for those files that need to build pre-Carbon applications.
  66. */
  67. /* o.constants*/
  68.  
  69.  
  70. typedef SInt16 BalloonVariant;
  71. enum {
  72.     kTopLeftTipPointsLeftVariant = 0,
  73.     kTopLeftTipPointsUpVariant    = 1,
  74.     kTopRightTipPointsUpVariant    = 2,
  75.     kTopRightTipPointsRightVariant = 3,
  76.     kBottomRightTipPointsRightVariant = 4,
  77.     kBottomRightTipPointsDownVariant = 5,
  78.     kBottomLeftTipPointsDownVariant = 6,
  79.     kBottomLeftTipPointsLeftVariant = 7,
  80.     kBalloonVariantCount        = 8
  81. };
  82.  
  83.  
  84. #ifndef __MACHELP__
  85. enum {
  86.     hmBalloonHelpVersion        = 0x0002                        /* The real version of the Help Manager */
  87. };
  88.  
  89. #endif  /* !defined(__MACHELP__) */
  90.  
  91. enum {
  92.     kHMHelpMenuID                = -16490,                        /* Resource ID and menu ID of help menu */
  93.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help... */
  94.     kHMShowBalloonsItem            = 3                                /* help menu item number of Show/Hide Balloons */
  95. };
  96.  
  97. enum {
  98.     kHMHelpID                    = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  99.     kBalloonWDEFID                = 126                            /* Resource ID of the WDEF proc used in standard balloons */
  100. };
  101.  
  102. enum {
  103.                                                                 /* Dialog item template type constant */
  104.     helpItem                    = 1                                /* key value in DITL template that corresponds to the help item */
  105. };
  106.  
  107. enum {
  108.                                                                 /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  109.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  110.     hmUseSubID                    = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  111.     hmAbsoluteCoords            = 2                                /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  112. };
  113.  
  114. enum {
  115.     hmSaveBitsNoWindow            = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  116.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  117.     hmMatchInTitle                = 16                            /* for hwin resources, match string anywhere in window title string */
  118. };
  119.  
  120. enum {
  121.                                                                 /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  122.     kHMStringItem                = 1,                            /* pstring used in resource */
  123.     kHMPictItem                    = 2,                            /* 'PICT' ResID used in resource */
  124.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  125.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  126.     kHMSTRResItem                = 7,                            /* 'STR ' ResID used in resource */
  127.     kHMSkipItem                    = 256,                            /* don't display a balloon */
  128.     kHMCompareItem                = 512,                            /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  129.     kHMNamedResourceItem        = 1024,                            /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  130.     kHMTrackCntlItem            = 2048                            /* Reserved */
  131. };
  132.  
  133. enum {
  134.                                                                 /* Constants for hmmHelpType's when filling out HMMessageRecord */
  135.     khmmString                    = 1,                            /* help message contains a PString */
  136.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  137.     khmmStringRes                = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  138.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  139.     khmmPictHandle                = 5,                            /* help message contains a Picture handle */
  140.     khmmTERes                    = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  141.     khmmSTRRes                    = 7,                            /* help message contains a res ID to a 'STR ' resource */
  142.     kHMEnabledItem                = 0                                /* item is enabled, but not checked or control value = 0 */
  143. };
  144.  
  145. enum {
  146.                                                                 /* ResTypes for Styled TE Handles in Resources */
  147.     kHMTETextResType            = FOUR_CHAR_CODE('TEXT'),        /* Resource Type of text data for styled TE record w/o style info */
  148.     kHMTEStyleResType            = FOUR_CHAR_CODE('styl')        /* Resource Type of style information for styled TE record */
  149. };
  150.  
  151. enum {
  152.     kHMDisabledItem                = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  153.     kHMCheckedItem                = 2,                            /* item is enabled, and checked or control value = 1 */
  154.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  155.                                                                 /* Method parameters to pass to HMShowBalloon */
  156.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  157.     kHMSaveBitsNoWindow            = 1,                            /* Just save the bits and draw (for MDEF calls) */
  158.     kHMSaveBitsWindow            = 2                                /* Regular window, save bits behind, AND generate update event */
  159. };
  160.  
  161. enum {
  162.                                                                 /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  163.     kHMMenuResType                = FOUR_CHAR_CODE('hmnu'),        /* ResType of help resource for supporting menus */
  164.     kHMDialogResType            = FOUR_CHAR_CODE('hdlg'),        /* ResType of help resource for supporting dialogs */
  165.     kHMWindListResType            = FOUR_CHAR_CODE('hwin'),        /* ResType of help resource for supporting windows */
  166.     kHMRectListResType            = FOUR_CHAR_CODE('hrct'),        /* ResType of help resource for rectangles in windows */
  167.     kHMOverrideResType            = FOUR_CHAR_CODE('hovr'),        /* ResType of help resource for overriding system balloons */
  168.     kHMFinderApplResType        = FOUR_CHAR_CODE('hfdr')        /* ResType of help resource for custom balloon in Finder */
  169. };
  170.  
  171. #ifndef __MACHELP__
  172.  
  173. struct HMStringResType {
  174.     short                             hmmResID;
  175.     short                             hmmIndex;
  176. };
  177. typedef struct HMStringResType            HMStringResType;
  178. #endif  /* !defined(__MACHELP__) */
  179.  
  180.  
  181. struct HMMessageRecord {
  182.     SInt16                             hmmHelpType;
  183.     union {
  184.         Str255                             hmmString;
  185.         SInt16                             hmmPict;
  186.         TEHandle                         hmmTEHandle;
  187.         HMStringResType                 hmmStringRes;
  188.         SInt16                             hmmPictRes;
  189.         PicHandle                         hmmPictHandle;
  190.         SInt16                             hmmTERes;
  191.         SInt16                             hmmSTRRes;
  192.     }                                 u;
  193. };
  194. typedef struct HMMessageRecord            HMMessageRecord;
  195.  
  196. typedef HMMessageRecord *                HMMessageRecPtr;
  197. typedef CALLBACK_API( OSErr , TipFunctionProcPtr )(Point tip, RgnHandle structure, Rect *r, BalloonVariant *balloonVariant);
  198. typedef STACK_UPP_TYPE(TipFunctionProcPtr)                         TipFunctionUPP;
  199. #if OPAQUE_UPP_TYPES
  200.     EXTERN_API(TipFunctionUPP)
  201.     NewTipFunctionUPP               (TipFunctionProcPtr        userRoutine);
  202.  
  203.     EXTERN_API(void)
  204.     DisposeTipFunctionUPP           (TipFunctionUPP            userUPP);
  205.  
  206.     EXTERN_API(OSErr)
  207.     InvokeTipFunctionUPP           (Point                    tip,
  208.                                     RgnHandle                structure,
  209.                                     Rect *                    r,
  210.                                     BalloonVariant *        balloonVariant,
  211.                                     TipFunctionUPP            userUPP);
  212.  
  213. #else
  214.     enum { uppTipFunctionProcInfo = 0x00003FE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  215.     #define NewTipFunctionUPP(userRoutine)                             (TipFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  216.     #define DisposeTipFunctionUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  217.     #define InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userUPP)  (OSErr)CALL_FOUR_PARAMETER_UPP((userUPP), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  218. #endif
  219. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  220. #define NewTipFunctionProc(userRoutine)                         NewTipFunctionUPP(userRoutine)
  221. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant) InvokeTipFunctionUPP(tip, structure, r, balloonVariant, userRoutine)
  222. /*  Public Interfaces  */
  223. EXTERN_API( OSErr )
  224. HMGetHelpMenuHandle                (MenuHandle *            mh)                                    THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  225.  
  226. EXTERN_API( OSErr )
  227. HMShowBalloon                    (const HMMessageRecord * inHelpMessage,
  228.                                  Point                     inTip,
  229.                                  Rect *                    inHotRect, /* can be NULL */
  230.                                  TipFunctionUPP         inTipProc,
  231.                                  SInt16                 inWindowProcID,
  232.                                  BalloonVariant         inBalloonVariant,
  233.                                  SInt16                 inMethod)                            THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  234.  
  235. EXTERN_API( OSErr )
  236. HMShowMenuBalloon                (SInt16                 itemNum,
  237.                                  SInt16                 itemMenuID,
  238.                                  SInt32                 itemFlags,
  239.                                  SInt32                 itemReserved,
  240.                                  Point                     tip,
  241.                                  Rect *                    alternateRect, /* can be NULL */
  242.                                  TipFunctionUPP         tipProc,
  243.                                  SInt16                 theProc,
  244.                                  BalloonVariant         balloonVariant)                        THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  245.  
  246. EXTERN_API( OSErr )
  247. HMRemoveBalloon                    (void)                                                        THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  248.  
  249. EXTERN_API( OSErr )
  250. HMGetIndHelpMsg                    (ResType                 inWhichResType,
  251.                                  SInt16                 inWhichResID,
  252.                                  SInt16                 inMessageIndex,
  253.                                  SInt16                 inMessageState,
  254.                                  UInt32 *                outOptions,
  255.                                  Point *                outTip,
  256.                                  Rect *                    outHotRect,
  257.                                  SInt16 *                outWindowProcID,
  258.                                  BalloonVariant *        outBalloonVariant,
  259.                                  HMMessageRecord *        outHelpMessage,
  260.                                  SInt16 *                outMessageCount)                    THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  261.  
  262. EXTERN_API( Boolean )
  263. HMIsBalloon                        (void)                                                        THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  264.  
  265. EXTERN_API( Boolean )
  266. HMGetBalloons                    (void)                                                        THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  267.  
  268. EXTERN_API( OSErr )
  269. HMSetBalloons                    (Boolean                 flag)                                THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  270.  
  271. EXTERN_API( OSErr )
  272. HMSetFont                        (SInt16                 font)                                THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  273.  
  274. EXTERN_API( OSErr )
  275. HMSetFontSize                    (UInt16                 fontSize)                            THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  276.  
  277. EXTERN_API( OSErr )
  278. HMGetFont                        (SInt16 *                font)                                THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  279.  
  280. EXTERN_API( OSErr )
  281. HMGetFontSize                    (UInt16 *                fontSize)                            THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  282.  
  283. EXTERN_API( OSErr )
  284. HMSetDialogResID                (SInt16                 resID)                                THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  285.  
  286. EXTERN_API( OSErr )
  287. HMSetMenuResID                    (SInt16                 menuID,
  288.                                  SInt16                 resID)                                THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  289.  
  290. EXTERN_API( OSErr )
  291. HMBalloonRect                    (const HMMessageRecord * inMessage,
  292.                                  Rect *                    outRect)                            THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  293.  
  294. EXTERN_API( OSErr )
  295. HMBalloonPict                    (const HMMessageRecord * inMessage,
  296.                                  PicHandle *            outPict)                            THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  297.  
  298. EXTERN_API( OSErr )
  299. HMScanTemplateItems                (SInt16                 whichID,
  300.                                  SInt16                 whichResFile,
  301.                                  ResType                 whichType)                            THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  302.  
  303. EXTERN_API( OSErr )
  304. HMExtractHelpMsg                (ResType                 inType,
  305.                                  SInt16                 inResID,
  306.                                  SInt16                 inMessageIndex,
  307.                                  SInt16                 inMessageState,
  308.                                  HMMessageRecord *        outMessage)                            THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  309.  
  310. EXTERN_API( OSErr )
  311. HMGetDialogResID                (SInt16 *                resID)                                THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  312.  
  313. EXTERN_API( OSErr )
  314. HMGetMenuResID                    (SInt16                 menuID,
  315.                                  SInt16 *                resID)                                THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  316.  
  317. EXTERN_API( OSErr )
  318. HMGetBalloonWindow                (WindowPtr *            window)                                THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325. #if PRAGMA_STRUCT_ALIGN
  326.     #pragma options align=reset
  327. #elif PRAGMA_STRUCT_PACKPUSH
  328.     #pragma pack(pop)
  329. #elif PRAGMA_STRUCT_PACK
  330.     #pragma pack()
  331. #endif
  332.  
  333. #ifdef PRAGMA_IMPORT_OFF
  334. #pragma import off
  335. #elif PRAGMA_IMPORT
  336. #pragma import reset
  337. #endif
  338.  
  339. #ifdef __cplusplus
  340. }
  341. #endif
  342.  
  343. #endif /* __BALLOONS__ */
  344.  
  345.